<html>
	<head>
    	<script language="javascript">
			self.moveTo(350,0);
		</script>
    </head>
	<body>
    	<table>
<?php
require("frmCookie.php");

$mySQL = "SELECT idModelo FROM modelos WHERE codigo = '" . $_GET['codigo'] . "'";
$result = readSQL($mySQL);
foreach($result as $value)
{
	$idModelo = $value['idModelo'];
}

$i = 0;
$mySQL = "SELECT idFoto FROM fotosxmodelo WHERE idModelo = $idModelo";
$result = readSQL($mySQL);
foreach($result as $value)
{
	if($i == 5)
		$i = 0;
		
	if($i == 0)
		echo "<tr>";
		
	echo "<td><img src='modeloFoto.php?id=" . $value['idFoto'] . "' /></td>";        
	if($i == 4)
	{
		echo "</tr>";
	}
	$i++;
}
if($i != 0)
	echo "</tr>";
?>
		</table>
	</body>
</html>